<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>17-获取焦点和失去焦点说明</title>
	</head>
	<body>
		<input type="text" name="username" id="username" value="手机">
		<script type="text/javascript">
			//获取元素对象
			var put = document.querySelector('#username');
			//获取焦点
			put.onfocus = function(){
				//alert(123);
				console.log(123);
				this.value = '';
			}
			//失去焦点
			put.onblur = function(){
				console.log(456);
				this.value = '手机';
			}
			
		</script>
	</body>
</html>
